#!/usr/bin/env python


def verify_card(card18):
    card17 = card18[:-1]
    card_last = card18[-1]
    if card_last == "X":
        card_last = "x"

    def validate_type():
        if isinstance(card17, (str, list, tuple)):
            if len(card17) == 17:
                return True
            else:
                return False
        else:
            return False

    if validate_type():
        if isinstance(card17, str):
            seq = map(int, card17)
        else:
            seq = card17
        t = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
        s = sum(map(lambda x: x[0] * x[1], zip(t, map(int, seq))))
        b = s % 11
        bd = {
            0: '1',
            1: '0',
            2: 'x',
            3: '9',
            4: '8',
            5: '7',
            6: '6',
            7: '5',
            8: '4',
            9: '3',
            10: '2'
        }
        if card_last == bd[b]:
            return True
    else:
        return False


if __name__ == '__main__':
    print(verify_card('14010219760103403x'), 5555)
